set -ex

rm -rf ./build
mkdir build
cd build

export CUDA_VISIBLE_DEVICES=7
ARCH=75
# export CUDA_VISIBLE_DEVICES=1
# ARCH=86
# export CUDA_VISIBLE_DEVICES=0
# ARCH=89
# export CUDA_VISIBLE_DEVICES=0
# ARCH=61
# export CUDA_VISIBLE_DEVICES=1
# ARCH=75

eval=1
perf=0
profile=0

if [ $eval -eq 1 ]; then
    cmake ../ -DARCH=$ARCH -DMODE="EVAL"
    make -j32
    python3 ../run_case.py ../../eval_gt/test_case_all.txt
    # python3 ../run_case.py ../../eval_gt/test_case.txt
fi

if [ $perf -eq 1 ]; then
    cmake ../ -DARCH=$ARCH -DMODE="PERF"
    # cmd="nsys profile --gpu-metrics-device=0 ./mp_gemm"
    cmd="./mp_gemm"
    make -j32
    $cmd
fi

if [ $profile -eq 1 ]; then
    cmake ../ -DARCH=$ARCH -DMODE="PROFILE"
    cmd="ncu --set full -k mp_gemm_w1a8_sm75 --target-processes all ./mp_gemm"
    make -j32
    $cmd
fi

# python3 eval_script/eval_speedup.py \
# eval_release/rel2/speedup_m_10_700_w_sm75.log:eval_release/rel0/speedup_m_10_700_w_sm75.log \
# sm75 eval_release/rel2/speedup_m_10_700_w_sm75.jpg